//
// Created by lxinp on 2022/8/10.
//

#ifndef DATASTRUCTURE_QUEUE_H
#define DATASTRUCTURE_QUEUE_H


/**
 * @brief Queue implemented using a circular array
 *        Data stored between [front, back)
 *        'back' is always empty, i.e. when full there is always 1 slot empty
 * @tparam T Data type
 */
template<typename T>
class Queue {
public:
    Queue();
    void resize();
    void enqueue(const T& data);
    T dequeue();
    bool is_empty() const;
    bool is_full() const;
    int size() const;
    void print() const;
    ~Queue();
private:
    T* q;
    int max_size;
    int front, back;
};


#endif //DATASTRUCTURE_QUEUE_H
